#include <iostream>

using namespace std;

int main () {
	cout << "const pointer" <<endl;
	int nX = 100, nY = 200;
	int * const npPtr = &nX;
	cout << "*npPtr = " << *npPtr << endl;	
	nX ++;
	cout << "*npPtr = " << *npPtr << endl;	
	*npPtr = 20;
	cout << "*npPtr = " << *npPtr << endl;	
	npPtr = &nY;	
	cout << "*npPtr = " << *npPtr << endl;	
	nY ++;
	cout << "*npPtr = " << *npPtr << endl;	
	return 0;
}

/*
 *  output
 *
 [sgupta@rhel6x86 const_pointer]$ make clean;make
rm -rf *.o test
g++ -g -O0 -D_THREAD_SAFE -Wextra -pedantic -Wall -c -fPIC -Wno-deprecated  main.cpp
main.cpp: In function ‘int main()’:
main.cpp:14: error: assignment of read-only variable ‘npPtr’
make: *** [main.o] Error 1
[sgupta@rhel6x86 const_pointer]$ 
 */
